<?
/***************************************************************************
 *   copyright : (C) 2009 Udrea Cristian
 *   site : http://code.google.com/p/testauction-php
 ***************************************************************************/

/***************************************************************************
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as 
 *   published by the Free Software Foundation; either version 2 of the
 *   License, or (at your option) any later version. Although none of the
 *   code may be sold. If you have been sold this script, get a refund.
 ***************************************************************************/
	class Tooltips
	{
		private $TooltipArray;
		
		public function __construct(){
			$this->TooltipArray = array();
		}
		
		public function createTooltip($name, $text){
			$this->TooltipArray[$name]=array($text, FALSE);
		}
		
		public function deleteTooltip($name){
			unset($this->TooltipArray[$name]);
		}
		
		public function flushTooltips(){
			unset($this->TooltipArray);
			$this->TooltipArray = array();
		}
		
		public function tooltipToString($name){
			$tooltip=$this->TooltipArray[$name];
			if($tooltip[1] == FALSE){
				return "<div id=\"".$name."\" class=\"tip\">".$tooltip[0]."</div>";
				$tooltip[1] = TRUE;
			}
		}
		
		public function getTooltipEvent($name){
			if(isset($this->TooltipArray[$name]))
				return "popUp(event,'".$name."')";
			return "\"\"";
		}

		public function writeOutTooltipEvents($name){
			$tooltip=$TooltipArray[$name];
			//Check to see if tooltip was written
			if($tooltip[1] == TRUE){
				echo "onmouseout=\"popUp(event,'".$name."')\" onmouseover=\"popUp(event,'".$name."')"; 
			}
		}
	}
	
$tooltips = new Tooltips();
?>
